﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;


namespace Indie_Game_Contest
{
    class InstructionState : IGameState
    {
        //////////////////////////////////////////////////////////////////////////
        // Data Members
        static InstructionState instance = new InstructionState();
        TextureManager tm = TextureManager.Instance;

        int fontID;
        private int m_nKitID = 0;
        private int m_nBoxerID = 0;
        private int m_nCatID = 0;


        String description0;
        String description1;
        String description2;
        String description3;
        String description4;
        String description5;
        String description6;
        String description7;
        String description8;
        String description9;
        String description10;
        String description11;
        String description12;
        String description13;



        //////////////////////////////////////////////////////////////////////////
        // Methods
        public override void Enter()
        {
            tm = TextureManager.Instance;
            description0 = "Backstory:";
            description1 = "This will be the very last show of Gossip.";
            description2 = "It's the un-named protagonist's final";
            description3 = "chance to prove his worth.";
            description4 = "Go out there and put a show on!";
            description5 = "Actors";
            description6 = "Instructions";
            description7 = "Be aware of other actors trying to stop";
            description8 = "your show!";
            description9 = "This indicates how much more the audience";
            description10 = "wants of your show. Keep it above zero by";
            //description10 = "Keep it above zero by defeating other actors on stage.";
            description11 = "defeating other actors on stage. Once it";
            description12 = "reaches zero, then the show is over.";
            description13 = "YOU";
            //description12 = "Once it reaches below zero, then the show is over.";
        }
        public override void Exit()
        {

        }
        public override void Update(float dt)
        {
        }
        public override bool Input()
        {
            // Exit
            if (CInput.Instance.KeyPressed(Keys.Escape) || CInput.Instance.GamePadButtonPressed(Buttons.B))
            {
                Game1.Instance.AddState(MainMenuSate.Instance);
                Game1.Instance.RemoveState(this);
            }

            return true;
        }
        public override void Render()
        {
            WorldData.spriteBatch.Draw(TextureManager.Instance.GetTexture(CTileManager.Instance.TileIDs["curtains"]),
                 new Rectangle(-15, 0, WorldData.WindowWidth + 30, WorldData.WindowHeight + 25), Color.White);

            Texture2D w = TextureManager.Instance.GetTexture(NKitID);
            Vector2 vPos = Vector2.Zero;
            vPos.X = 150.0f;
            vPos.Y = 180.0f;
            WorldData.spriteBatch.Draw(w, vPos, null, Color.White, 0, Vector2.Zero, 1.0f, SpriteEffects.None, 0);

            vPos.X += 50.0f;
            w = TextureManager.Instance.GetTexture(NBoxerID);
            WorldData.spriteBatch.Draw(w, vPos, null, Color.White, 0, Vector2.Zero, 1.0f, SpriteEffects.None, 0);

            w = TextureManager.Instance.GetTexture(NCatID);
            WorldData.spriteBatch.Draw(w, new Vector2((WorldData.WindowWidth / 2) - 30, 60) , null, Color.White, 0, Vector2.Zero, 2.0f, SpriteEffects.None, 0);

            w = TextureManager.Instance.GetTexture(HUD.Instance.Life_icon);
            
            WorldData.spriteBatch.Draw(w, new Vector2( 500, 150), null, Color.White, 0, Vector2.Zero, 1.0f, SpriteEffects.None, 0);
            WorldData.spriteBatch.DrawString(tm.GetSpriteFont(fontID), description9, new Vector2(325, 180), Color.White, 0.0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0);
            WorldData.spriteBatch.DrawString(tm.GetSpriteFont(fontID), description10, new Vector2(325, 200), Color.White, 0.0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0);
            WorldData.spriteBatch.DrawString(tm.GetSpriteFont(fontID), description11, new Vector2(325, 220), Color.White, 0.0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0);
            WorldData.spriteBatch.DrawString(tm.GetSpriteFont(fontID), description12, new Vector2(325, 240), Color.White, 0.0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0);


            
          

            
           // static int s = 0;
            WorldData.spriteBatch.DrawString(tm.GetSpriteFont(fontID), description0, new Vector2(60, WorldData.WindowHeight - 230), Color.White);
            WorldData.spriteBatch.DrawString(tm.GetSpriteFont(fontID), description1, new Vector2(60, WorldData.WindowHeight - 200), Color.White);
            WorldData.spriteBatch.DrawString(tm.GetSpriteFont(fontID), description2, new Vector2(60, WorldData.WindowHeight - 170), Color.White);
            WorldData.spriteBatch.DrawString(tm.GetSpriteFont(fontID), description3, new Vector2(60, WorldData.WindowHeight - 140), Color.White);
            WorldData.spriteBatch.DrawString(tm.GetSpriteFont(fontID), description4, new Vector2(60, WorldData.WindowHeight - 110), Color.White);
            WorldData.spriteBatch.DrawString(tm.GetSpriteFont(fontID), description7, new Vector2(65, WorldData.WindowHeight - 80), Color.White);
            WorldData.spriteBatch.DrawString(tm.GetSpriteFont(fontID), description8, new Vector2(90, WorldData.WindowHeight - 50), Color.White);

            WorldData.spriteBatch.DrawString(tm.GetSpriteFont(fontID), description5, new Vector2(145.0f, 140.0f), Color.White);
            WorldData.spriteBatch.DrawString(tm.GetSpriteFont(fontID), description6, new Vector2((WorldData.WindowWidth / 2) - 105, 0), Color.SkyBlue);
            WorldData.spriteBatch.DrawString(tm.GetSpriteFont(fontID), description13, new Vector2((WorldData.WindowWidth / 2) - 40, 30), Color.White);
        }

        //////////////////////////////////////////////////////////////////////////
        // Properties
        public static InstructionState Instance
        {
            get { return instance; }
        }
        public int FontID
        {
            get { return fontID; }
            set { fontID = value; }
        }

        public int NKitID
        {
            get { return m_nKitID; }
            set { m_nKitID = value; }
        }

        public int NBoxerID
        {
            get { return m_nBoxerID; }
            set { m_nBoxerID = value; }
        }

        public int NCatID
        {
            get { return m_nCatID; }
            set { m_nCatID = value; }
        }

    }
}
